package hu.plajko.client;

import hu.plajko.shared.rpc.NotificationRPC;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.user.client.rpc.SerializationException;

/**
 * The client side stub for the RPC service.
 */
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {

	String generate(String input) throws SerializationException;

	public List<NotificationRPC> getNotifications() throws SerializationException;
	
	public String updateNotification(NotificationRPC n) throws SerializationException;
	
	public void removeNotification(NotificationRPC n) throws SerializationException;
	
	public void clearNotifications() throws SerializationException;
	
	public NotificationRPC getData(String id) throws SerializationException;
	

	// Client side instance
	public static class Client {
		private static GreetingServiceAsync ourInstance = null;

		public static synchronized GreetingServiceAsync getInstance() {
			if (ourInstance == null) {
				ourInstance = (GreetingServiceAsync) GWT.create(GreetingService.class);
			}
			return ourInstance;
		}
	}

}
